package model

// User represents the users table
type User struct {
	BaseModel
	Number      string    `gorm:"column:number;NOT NULL;unique" json:"number"`
	Name        string    `gorm:"column:name;NOT NULL" json:"name"`
	Password    string    `gorm:"column:password;NOT NULL" json:"password"`
	IsVIP       bool      `gorm:"column:isVIP;NOT NULL" json:"is_vip"`
	IsAdmin     bool      `gorm:"column:isAdmin;NOT NULL" json:"is_admin"`
	Status      int       `gorm:"column:status;NOT NULL" json:"status"`
	Email       string    `gorm:"column:email;NOT NULL" json:"email"`
	Description string    `gorm:"column:description;NOT NULL" json:"description"`
	Order       []Order   `gorm:"foreignKey:UserID" json:"orders"`
	Cart        []Cart    `gorm:"foreignKey:UserID" json:"carts"`
	Comment     []Comment `gorm:"foreignKey:UserID" json:"comments"`
}

// TableName sets the insert table name for this struct type
func (u *User) TableName() string {
	return "users"
}
